/**********************************************************************************************************************
 * @file    nmea_gst.c
 * @author  Queclink Jason.Huang
 * @date    2023-10-09
 * @brief   NMEA-RMC frame source.
 *
 * Copyright (C) 2023 Queclink Wireless Solutions (ShenZhen) Co., Ltd. All Rights Reserved.
 *
 * @attention
 *
 * @usage
 *
 *********************************************************************************************************************/

/* includes ---------------------------------------------------------------------------------------------------------*/
#include <stdlib.h>
#include <string.h>
#include "nmea.h"

/*
 * @brief  GST消息解析
 * @note
 * @param  argc: [I], 消息分割后字符串数量
 *         argv: [I], 字符串地址列表
 * @retval none
 */
void nmea_gst_parse(int argc, char *argv[])
{
    nmea_protocol_parse_t *nmea_ptr = get_nmea_manage_context();

    /* argv 6, Standard deviation of latitude error */
    /* argv 7, Standard deviation of longitude error */
    /* argv 8, Standard deviation of altitude error */

    /* 负数代表无效, 不进行过滤 */
    if (0 < strlen(argv[6]))
       nmea_ptr->stderr_.lat = atof(argv[6]);
    else
       nmea_ptr->stderr_.lat = -1.0;

    if (0 < strlen(argv[7]))
       nmea_ptr->stderr_.lng = atof(argv[7]);
    else
       nmea_ptr->stderr_.lng = -1.0;

    if (0 < strlen(argv[8]))
       nmea_ptr->stderr_.alt = atof(argv[8]);
    else
       nmea_ptr->stderr_.alt = -1.0;
}
